package holdobject;

import typeinfo.pets.*;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static net.mindview.util.Print.print;

public class MapOfList {
    public static Map<Person, List<? extends Pet>>  petPeople=new HashMap<Person, List<? extends Pet>>();
    static {
        petPeople.put(new Person("ZHANG"), Arrays.asList(new Cymric("mol"),new Mutt("spot")));
        //Arrays.List将数组转换为链表
        petPeople.put(new Person("wang"),Arrays.asList(new Cat("sha"),new Cat("ELS"),new Dog("Mar")));
        petPeople.put(new Person("zhao"),Arrays.asList(new Pug("L A L S D"),
                new Cat("S A S E N"),
                new Cat("Pink")
        ));
        petPeople.put(new Person("LUKE"),Arrays.asList(new Rat("Fuzzy"),new
                Rat("Fizzy")
                ));
    }

    public static void main(String[] args) {
        print("People:"+petPeople.keySet());//返回此集合包含的键的set集合
        print("Pets:"+petPeople.values());
        for (Person person:petPeople.keySet()){
            print("person has: "+ person);
            for (Pet pet:petPeople.get(person))
                print(pet);
        }
    }
}
